<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<?php
$id=$_GET['id'];

$uname=$_POST["uname"];
// $ipx=$_POST["ipx"];
$age=$_POST["age"];
$newurl="./img/".time()."_".$_FILES["ipx"]["name"];
// echo $uname."_".$ipx."_".$age."_".$newurl;
// echo "ipx:".$ipx."____";
// echo $_FILES["ipx"]["name"];
 echo "uname:".$uname."____";
 echo "age:".$age."____";
 echo "newurl:".$newurl."____";
 echo "id:".$id."____";
$hostname="127.0.0.1";
$username="root";
$password="123456";
$database="mysql123";



$connet=mysqli_connect($hostname, $username, $password, $database);
mysqli_set_charset($connet, "utf-8");

// $sql="select * from user_inf where uid=$id ";
// $sql="update user_inf set age=$age,uname='$uname',ipx='$ipx' where uid=$id";




// $result=mysqli_query($connet,$sql);

// $row=mysqli_fetch_array($result);

//查询该ID下的用户信息

?>




<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
    
<?php
    if($connet){
        move_uploaded_file($_FILES["ipx"]["tmp_name"], $newurl);
//获取暂存文件到本地

        $sql="update user_inf set age='$age',uname='$uname',ipx='$newurl' where uid=$id";
        $result=mysqli_query($connet,$sql);
//        $row=mysqli_fetch_array($result);
        //mysqli_fetch_array($result)是获得一个结果集。而现在的$result中执行的SQL语句是更新语句，并没有返回结果集，而是返回true\false
      
        echo "修改成功";
//            $sqlstring="insert into user_inf(uname,age,ipx) "
//                   ." values('$uname','$uage','$newurl')";
//               $result= mysqli_query($connet, $sqlstring);
//               echo "添加成功。";
//            $row= mysqli_fetch_array($result);
//               mysqli_close($connet);
        }


?>
         <?php mysqli_close($connet);?>
    </body>
</html>